package com.bawei.util;


public class Jsonutils {

	private String code;
	private Object data;
	private String msg;
	
	private transient final static String SUCCESS_CODE = "200";
	private transient final static String ERROR_CODE = "400";

	private Jsonutils() {

	}

	public static Jsonutils success(Object obj) {
		return new Jsonutils().setCode(SUCCESS_CODE).setData(obj);
	}
	
	public static Jsonutils success() {
		return new Jsonutils().setCode(SUCCESS_CODE);
	}
	public static Jsonutils error(String msg) {
		return new Jsonutils().setMsg(msg).setCode(ERROR_CODE);
	}
	public String getCode() {
		return code;
	}

	public Jsonutils setCode(String code) {
		this.code = code;
		return this;
	}

	public Object getData() {
		return data;
	}

	public Jsonutils setData(Object data) {
		this.data = data;
		return this;
	}

	public String getMsg() {
		return msg;
	}

	public Jsonutils setMsg(String msg) {
		this.msg = msg;
		return this;
	}

}
